package stack;

/**
 * @program: algorithm
 * @description: 计时器数据类型
 * @author: Yan.Zhang
 * @create: 2020-04-23 09:51
 **/
public class Stopwatch {

    private final long start;

    public Stopwatch() {
        start = System.currentTimeMillis();
    }

    public double elapsedTime(){
        long now = System.currentTimeMillis();
        return (now - start) / 1000.0;
    }


    public static void main(String[] args){
        Stopwatch stopwatch = new Stopwatch();
        // todo 处理业务代码
        System.out.println(stopwatch.elapsedTime());
    }
}